package com.wave.wavesystem.serve.pojo.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.RelationManyToOne;
import com.mybatisflex.annotation.RelationOneToMany;
import com.mybatisflex.annotation.Table;
import com.wave.common.model.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;


@Data
@Table("wave_menu")
@EqualsAndHashCode(callSuper = true)
public class Menu extends BaseEntity {

    @Column(value = "name", comment = "菜单名称")
    private String name;

    @Column(value = "routePath", comment = "菜单路由")
    private String routePath;

    @Column(value = "component", comment = "组件地址")
    private String component;

    @Column(value = "parentId", comment = "父菜单")
    private Long parentId;

    @Column(value = "icon", comment = "图标")
    private String icon;

    @Column(value = "sort", comment = "排序（升序）")
    private Integer sort;

    @Column(value = "status", comment = "0-正常 1-暂停使用")
    private Integer status;

    @RelationManyToOne(selfField = "parentId", targetField = "id")
    private Menu parent;

    @RelationOneToMany(selfField = "id", targetField = "parentId")
    private List<Menu> children = new ArrayList<>();

}